]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
ShellAppMonitor: Correctly handle transients
authorColin Walters <walters@verbum.org>
Tue, 11 Aug 2009 18:54:51 +0000 (14:54 -0400)
committerColin Walters <walters@verbum.org>
Wed, 12 Aug 2009 14:10:19 +0000 (10:10 -0400)
If looking up the application for a transient window, try look up
its transient source.  Ignore transients for the purposes of counting
open windows.

src/shell-app-monitor.c

index 084b4371e5063a76af11926d497463248bf161d1..0a9e80f20e7ff06fb82b84c6418f98560cd0172c 100644 (file)
@@ -271,9 +271,6 @@ get_cleaned_wmclass_for_window (MetaWindow  *window)
   char *wmclass;
   char *cleaned_wmclass;
 
-  if (meta_window_get_window_type (window) != META_WINDOW_NORMAL)
-    return NULL;
-
   wmclass = get_wmclass_for_window (window);
   if (!wmclass)
     return NULL;
@@ -510,6 +507,16 @@ track_window (ShellAppMonitor *self,
 {
   ShellAppInfo *app;
   AppUsage *usage;
+  MetaWindow *transient_for;
+
+  /* Just ignore anything that isn't NORMAL */
+  if (meta_window_get_window_type (window) != META_WINDOW_NORMAL)
+    return;
+
+  /* Also ignore transients */
+  transient_for = meta_window_get_transient_for (window);
+  if (transient_for != NULL)
+    return;
 
   app = get_app_for_window (window);
   if (!app)
@@ -634,6 +641,8 @@ on_session_status_changed (DBusGProxy      *proxy,
  * @self:
  * @appid: Find windows for this id
  *
+ * Returns the normal toplevel windows associated with the given application.
+ *
  * Returns: (transfer container) (element-type MetaWindow): List of #MetaWindow corresponding to appid
  */
 GSList *
@@ -826,7 +835,14 @@ ShellAppInfo *
 shell_app_monitor_get_window_app (ShellAppMonitor *monitor,
                                   MetaWindow      *metawin)
 {
-  ShellAppInfo *info = g_hash_table_lookup (monitor->window_to_app, metawin);
+  MetaWindow *transient_for;
+  ShellAppInfo *info;
+
+  transient_for = meta_window_get_transient_for (metawin);
+  if (transient_for != NULL)
+    metawin = transient_for;
+
+  info = g_hash_table_lookup (monitor->window_to_app, metawin);
   if (info)
     shell_app_info_ref (info);
   return info;